import Vue from 'vue'
import Router from 'vue-router'

const Login = resolve => require(['@/components/login/Login'], resolve);
const Register = resolve => require(['@/components/login/Register'], resolve);
const Index = resolve => require(['@/components/index/Index'], resolve);
const Post = resolve => require(['@/components/Post'], resolve);
const NewPost = resolve => require(['@/components/NewPost'], resolve);

Vue.use(Router);

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/index',
      name: 'Index',
      component: Index
    },
    {
      path: '/post/:id',
      name: 'Post',
      component: Post
    },
    {
      path: '/new/post',
      name: 'NewPost',
      component: NewPost
    },
  ]
})
